Skip to content

Conversation

@y21
Copy link
Member

@y21 y21 commented Dec 21, 2024

Fixes #13862

missing_headers::check is sometimes called from outside of a body (specifically, from check_attributes, where the LateContext's ParamEnv is not yet properly initialized for that item). Using that empty ParamEnv for trait solving things from within the body can then lead to various ICEs, like the linked issue where we have a const generic parameter DMA_INST without a ConstArgHasType bound in the ParamEnv so the const parameter has no type, which is normally not supposed to happen.

We have the item's DefId so we can just get its ParamEnv/TypingEnv from there, and using that one for trait solving should be safe.

changelog: none

@rustbot
Copy link
Collaborator

rustbot commented Dec 21, 2024

r? @dswij

rustbot has assigned @dswij.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Dec 21, 2024
@dswij dswij added this pull request to the merge queue Dec 29, 2024
Merged via the queue into rust-lang:master with commit c8ba3e1 Dec 29, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ICE when evaluating trait selection obligation

3 participants